home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Tools & Apps / Testing & Debugging / Report Error 1.2 / stringUtilities.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-31  |  2.2 KB  |  70 lines  |  [TEXT/KAHL]

  1. /*================================================================================
  2.     stringUtilities.h
  3.     
  4.     Greg Anderson
  5.     28 June 1991
  6.     greggor@apple.com
  7.         
  8.     This .h file provides macros for scanning through strings.
  9.     It is assumed that all strings being scanned are null-terminated
  10.         
  11. ================================================================================*/
  12. #ifndef __STRINGUTILITIES__
  13. #define __STRINGUTILITIES__
  14.  
  15. #ifndef __TYPES__
  16. #include <Types.h>
  17. #endif
  18.  
  19. /*
  20. // Macros:
  21. //
  22. // ToUpper(c)
  23. //
  24. //        Convert 'c' to an uppercase character if it is a lowercase character
  25. //
  26. // SkipToWhiteSpace(p)
  27. //
  28. //        Skip to the next whitespace character (or null)
  29. //
  30. // SkipPastWhitespace(p)
  31. //
  32. //        Skip to the next non-whitespace character (or null)
  33. //
  34. // SkipToSpec(p,spec)
  35. //
  36. //        Skip to the next occurance of the specified character (or null)
  37. //
  38. // SkipToDigit(p)
  39. //
  40. //        Skip to the next numeric digit (or null)
  41. //
  42. // SkipToNextLine(p)
  43. //
  44. //        Like it says:  skip to the beginning of the next line
  45. */
  46. #define ToUpper(c) ( ((c >= 'a') && (c <= 'z')) ? c - 'a' + 'A' : c )
  47. #define SkipToWhitespace( line ) while( *(line) > ' ' ) (line)++
  48. #define SkipPastWhitespace( line ) while( (*(line) <= ' ') && (*(line) != '\r') && (*(line)) ) (line)++
  49. #define SkipToSpec( line, spec ) while( (*(line) != spec) && (*(line)) ) (line)++
  50. #define SkipToDigit( line ) while( ((*(line) < '0') || (*(line) > '9')) && (*(line)) ) (line)++
  51. #define SkipToNextLine( line ) do{ SkipToSpec(line, '\r'); while( (*(line) < ' ') && (*(line)) ) (line)++; } while(false)
  52.  
  53. /*
  54. // Prototypes for stringUtilities.c
  55. */
  56. pascal void            PtoCcpy( char* cstr, Str255 pstr );
  57. pascal void            CtoPcpy(  Str255 pstr, char* cstr );
  58. pascal short        PtoCcmp( Str255 pstr, char* cstr );
  59. pascal void            pstrcpy( Str255 dest, Str255 src );
  60. pascal void            pstrcat( Str255 dest, Str255 src );
  61. pascal short        pstrcmp( unsigned char* a, unsigned char* b );
  62. pascal short        partialstrcmp( register char* s1, register char* s2);
  63. pascal short        ScanNumberInString( char** line );
  64. pascal short        NumberInString( char* line );
  65. pascal void            ScanTextInString( char** line, Str255 pstr, Boolean terminateAtSpace );
  66. pascal void            ScanWordInString( char** line, Str255 pstr );
  67. pascal void            ScanLineInString( char** line, Str255 pstr );
  68.  
  69. #endif
  70.